<template>
  <div>
    <ul>
      <li v-for="item in cartItems">
        {{ item.title }}: ￥{{ item.price }} x {{ item.quantity }} = ￥{{ item.quantity * item.price }}
      </li>
    </ul>
    <div>
      商品总价为：￥{{ totalPrice }}
    </div>
  </div>
</template>

<script>
  import { mapState, mapGetters } from 'vuex'
  export default {
    computed: {
      ...mapState('cart', ['cartItems']),
      ...mapGetters('cart', ['totalPrice'])
    }
  }
</script>

<style scoped>

</style>